package com.yanqu.road.server.cmd.unionwar;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.unionwar.UnionWarActivityServerProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.unionwar.CrossUnionWarMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

/**
 * @author ：zfr
 * @date ：2022/3/21 15:50
 */
@Cmd(code = CrossProtocol.C_CROSS_UNION_WAR_REQ_SYNC_DETAIL, desc = "请求同步备战数据")
public class CrossUnionWarReqSyncDetailCmd extends CrossUnionCommand {
    private int activityId;
    private List<String> unionUidList;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        UnionWarActivityServerProto.ReqCrossSyncDetailMsg reqCrossSyncDetailMsg = UnionWarActivityServerProto.ReqCrossSyncDetailMsg.parseFrom(packet.getBytes());
        activityId = reqCrossSyncDetailMsg.getActivityId();
        unionUidList = reqCrossSyncDetailMsg.getUnionUidList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossUnionWarMgr.syncAllDetailToServer(activityId, unionUidList, serverId);
    }

    @Override
    public void sendData() {

    }
}
